home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_05
/
8n05027a
< prev
next >
Wrap
Text File
|
1990-04-17
|
902b
|
42 lines
*****Listing 2*****
#include <stdio.h>
void f(long [][5]);
main()
{
static long a[3][5] = {
{ 1, 2, 3, 4, 5},
{ 6, 7, 8, 9,10},
{11,12,13,14,15}
};
f(a);
}
void f(long a[][5])
{
printf("a[0][2] = %2d\n", a[0][2]);
printf("a[1][0] = %2d\n", a[1][0]);
printf("a[2][4] = %2d\n", a[2][4]);
printf("sizeof(long) = %lu\n",
(unsigned long)sizeof(long));
printf("sizeof(long *) = %lu\n",
(unsigned long)sizeof(long *));
printf("sizeof(a) = %lu\n",
(unsigned long)sizeof(a));
printf("sizeof(*a) = %lu\n",
(unsigned long)sizeof(*a));
}
a[0][2] = 3
a[1][0] = 6
a[2][4] = 15
sizeof(long) = 4
sizeof(long *) = 2
sizeof(a) = 2
sizeof(*a) = 20